package edu.mse.camel.client.chat.handler;

import edu.mse.camel.client.eventbus.pubsub.ISubscriber;
import edu.mse.camel.client.events.EventIDs;
import edu.mse.camel.client.events.IEvent;
import edu.mse.camel.client.events.server.NotifyLoginStatusChange;

/*
 * This event is to handle the situation when the user login or logout 
 * to the system. 
 */
public class LoginStatusChangeEventHandler implements ISubscriber{

	@Override
	public void notifyEvent(IEvent e) {
		if (e.getEventID().equalsIgnoreCase(EventIDs.NOTIFY_LOGIN_STATUS_CHANGE_EVENT)){
			NotifyLoginStatusChange lscEvent = (NotifyLoginStatusChange) e;
			if(lscEvent.isLoggedIn()){
//				Participant me = new Participant();
//				me.setName(lscEvent.getId());
//				ParticipantList.getInstance().setMe(me);
//				ParticipantList.getInstance().setMyStatus(ParticipantList.STATUS.ONLINE);
//			} else {
//				ParticipantList.getInstance().setMe(null);
//				ParticipantList.getInstance().setMyStatus(ParticipantList.STATUS.OFFLINE);
			}
		}
	}
	
}
